<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
	class Register extends CI_Controller
	{
		public function __construct()
		{
			parent::__construct();
		}
		
		public function index()
		{
			$dataObj = new DataObject();
			
			// Validation rules moved to separate config
				
			// If the form fails, make sure to load same view, specific fail title
			// Else display succeess page with success title
			if($this->form_validation->run() == FALSE)
			{
				$dataObj->SetTitle(getRegViewTitle());
				$dataObj->SetContent(getRegViewUrl());
			}
			else
			{
				$dataObj->SetTitle(getRegViewSuccessTitle());
				$dataObj->SetContent(getRegViewSuccessUrl());
				
				$this->register_model->register_new_user(getRegUsername(), getRegPassword(), getRegEmail());
			}
			
			$this->load->view(index_page(), array($dataObj->GetName() => $dataObj));
		}
	}